package pack0714.com;

public class Person implements Runnable{

    public String name ;
    public int n=0;
    public Person(String name){
        this.name=name;
    }

    public synchronized void sing(){
        n++;
            System.out.println(name+n+"在唱歌");
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            System.out.println(name+ +n+"醒来了");


    }
    @Override
    public void run() {
        sing();

    }
}
